<?php
namespace App\Extend\Ali;

use Alipay\EasySDK\Kernel\Config;
use Alipay\EasySDK\Kernel\Factory;

class EasySdk
{
    public function getToken($code){
        $options = new Config();
        $options->protocol = 'https';
        $options->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
        $options->appId = config('web.ali_account.appid');
        $options->rsaPrivateKey = config('web.ali_account.rsaPrivateKey');
        $options->alipayrsaPublicKey=config('web.ali_account.alipayrsaPublicKey');
        Factory::setOptions($options);
        $result = Factory::base()->oauth()->getToken($code);
        return $result;
    }
}